package csc.fresher.spring.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import csc.fresher.spring.dao.UserDAOImpl;

@Controller
@RequestMapping(value = "/delete")
public class DeleteController {
	
	@Autowired
	private UserDAOImpl dao;

	@RequestMapping(value = "/{username}")
	public String delete(@PathVariable String username, Model model){
		dao.deleteUserRole(username);
		dao.deleteUser(username);
		model.addAttribute("listUser", dao.listUser());
		return "listuser";
	}
}
